﻿using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Text;

namespace GXJD.Wx.DBContext
{
    public class WxDBContext : DbContext
    {
        public WxDBContext(DbContextOptions options) : base(options)
        { }

        public WxDBContext() { } // Default constructor  

        #region 新闻列表
        public DbSet<Wx.DBModel.News> News { get; set; }
        public DbSet<GXJD.Wx.DBModel.NewsPush.NewsWebSite> NewsWebSites { get; set; }
        
        #endregion

        #region 流程邮件
        public DbSet<Wx.DBModel.ApprovalMail> Mails { get; set; }
        #endregion

#if DEBUG
        /*
        //创建数据库表的脚本是，需要当前函数，除此之外应注释掉
        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {
            //PostgreSQL
            var _connString = "User ID=gxjd;Password=gxjd123456;Host=192.168.99.4;Port=5432;Database=gxjd_ywxt;Pooling=true;Encoding=UNICODE;";
            optionsBuilder.UseNpgsql(_connString);

            //SQLite
            //var _connString = @"Data Source=pm.db";
            //optionsBuilder.UseSqlite(_connString);
        }
        //*/
#endif
    }
}
